/*!
\file Input.h
\author Po
\brief DirectInput wrapper class.
*/
#pragma once

#define DIRECTINPUT_VERSION 0x0800

#include <d3d9.h>
#include <d3dx9.h>
#include <dinput.h>

/*!
\class Input
\brief A static DirectInput wrapper provide basic keyboard/mouse input detection.
*/
class Input
{
public:
	enum Orientation{MouseY, MouseX, MouseZ};

private:
	Input(void);
	~Input(void);

public:
	/*! Initialize direct input. */
	static bool Initialize(HWND hWnd, HINSTANCE hInstance, DWORD dwKeyboardCooperative, DWORD dwMouseCooperative);
	/*! Release direct input. */
	static void Release();

public:
	/*! Should call this function one frame a time, before any other Update(). */
	static void Update(); 

public:
	/*! Get mouse raw move range. */
	static long GetAxisRaw(Orientation eOrient);
	/*! Check key press. */
	static bool GetKeyDown(int nKey);  
	/*! Check mouse button press. */
	static bool GetButtonDown(int nbutton);	

private:
	static IDirectInput8 *sm_pDirectInput;  
	static IDirectInputDevice8 *sm_pKeyboard;  
	static IDirectInputDevice8 *sm_pMouse;
	static DIMOUSESTATE sm_MouseState;
	static char sm_keyBuffer[256];
};

